package cn.beyondPlatform.wei.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/*@Data
@AllArgsConstructor
@NoArgsConstructor*/
public class AjaxResult {

    private String msg;
    private String code;
    private Object data;


    private AjaxResult(String msg, String code, Object data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
    }

    public static AjaxResult success() {
        return new AjaxResult("success", "200", null);
    }

    public static AjaxResult success(String msg) {
        return new AjaxResult(msg, "200", null);
    }

    public static AjaxResult success(Object data) {
        return new AjaxResult("success", "200", data);
    }

    public static AjaxResult error() {
        return new AjaxResult("error", "500", null);
    }

    public static AjaxResult error(String msg) {
        return new AjaxResult(msg, "500", null);
    }

    public static AjaxResult error(Object data) {
        return new AjaxResult("error", "500", data);
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
